package com.example.designpartten.factory.product;

/**
 * 子类去决定创建哪个类
 */
public class ConCreator extends Creator {

    @Override
    public <T extends Product> T createProduct(Class<T> c) {

        Product product = null;
        try {
             product  =(Product) Class.forName(c.getName()).newInstance();

        } catch (Exception e) {
            e.printStackTrace();
        }

        return (T)product;
    }


}
